﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

// 用于实现主角球的运动

public class BallMovement : MonoBehaviour
{
    public float speed;

    private Rigidbody ballRigidbody;

    // Start is called before the first frame update
    void Start()
    {
        ballRigidbody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        float horizontal = Input.GetAxis("Horizontal");
        float vertical = Input.GetAxis("Vertical");

        ballRigidbody.AddForce(new Vector3(horizontal, 0, vertical)*speed);
    }
}
